import 'package:epflutter/routes.dart';
import 'package:epflutter/scoped_model/auth.dart';
import 'package:epflutter/scoped_model/city.dart';
import 'package:epflutter/scoped_model/room_filter.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:scoped_model/scoped_model.dart';

class Application extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Router router = Router();
    Routes.configureRoutes(router);
    return ScopedModel<AuthModel>(
      model: AuthModel(),
      child: ScopedModel<CityModel>(
        model: CityModel(),
        child: ScopedModel<FilterBarModel>(
          model: FilterBarModel(),
          child: MaterialApp(
            // 设置主题颜色
            theme: ThemeData(primaryColor: Colors.green),
            // 设置路由处理
            onGenerateRoute: router.generator,
            // 设置默认加载路由
            initialRoute: Routes.loading,
          ),
        ),
      ),
    );
  }
}